package com.icarsaas.saas.master.repository;

import com.icarsaas.saas.master.model.MasterTenant;
import com.icarsaas.saas.tenant.system.repository.BaseRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;


@Repository
public interface MasterTenantRepository extends MasterTenantRepositoryCustom, BaseRepository<MasterTenant, Long>, JpaSpecificationExecutor<MasterTenant> {
    /**
     * 根据租户id查找租户
     * @param tenantId
     * @return
     */
    @Query("select p from MasterTenant p where p.tenantId = :tenantId")
    MasterTenant findByTenantId(@Param("tenantId") String tenantId);



}
/* 自定义接口
 */
interface MasterTenantRepositoryCustom extends MasterBaseRepository<MasterTenant, Long> {

}
@Repository
class MasterTenantRepositoryImpl extends MaterBaseRepositoryImpl<MasterTenant, Long> implements MasterTenantRepositoryCustom {

}